Chroma-key for efficient and low complexity shape representation of coded arbitrary video objects

ABSTRACT

A technique for implicitly encoding shape information by using a chroma-key color. A bounding box is created enclosing the video object. The bounding box is extended to be of size of next integer multiple of macroblock size and divided into a plurality of macroblocks. For each boundary macroblock, each pixel outside the object is replaced with the chroma-key color to implicitly encode shape information. Pixel data for boundary macroblocks and macroblocks inside the object are DCT transformed, scaled and motion compensated. A finer quantizer (smaller quantizer) is used for boundary macroblocks to improve image quality. A first_shape_code can be used to identify each macroblock as either 1) inside the object; 2) outside the object; or 3) on the object boundary. To improve data compression and achieve low complexity shape extraction with DCT and motion compensation, a first_shape_code is sent for all macroblocks, and only macroblocks that are inside the object or on the object boundary are coded. The decoding system decodes the first_shape_code and, if necessary, the DCT and motion compensation information. The motion compensated luminance and chrominance pixel values of a reconstructed object at the decoding system are compared to the chroma-key color and thresholds to reconstruct the shape of the object, and to output texture information of the video object.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of U.S. Pat. ApplicationSer. No. 09/112,413, filed Jul. 9, 1998, which claims priority from U.S.Provisional Application Ser. No. 60/052,971, filed on Jul. 18, 1997, andwas a continuation-in-part of application Ser. No. 08/801,716, filed onFeb. 14, 1997 entitled “Method and Apparatus for Coding SegmentedRegions Which May Be Transparent In Video Sequences For Content-BasedScalability,” now U.S. Pat. No. 5,974,172 which is incorporated byreference herein.

BACKGROUND OF THE INVENTION

The present invention relates to the field of digital video codingtechnology and, more particularly, to a method and apparatus forproviding an improved chroma-key shape representation of video objectsof arbitrary shape.

A variety of protocols for communication, storage and retrieval of videoimages are known. Invariably, the protocols are developed with aparticular emphasis on reducing signal bandwidth. With a reduction ofsignal bandwidth, storage devices are able to store more images andcommunications systems can send more images at a given communicationrate. Reduction in signal bandwidth increases the overall capacity ofthe system using the signal.

However, bandwidth reduction may be associated with particulardisadvantages. For instance, certain known coding systems are lossybecause they introduce errors which may affect the perceptual quality ofthe decoded image. Others may achieve significant bandwidth reductionfor certain types of images but may not achieve any bandwidth reductionfor others. Accordingly, the selection of coding schemes must becarefully considered.

The Motion Picture Expert Group (MPEG) has successfully introduced twostandards for coding of audiovisual information, known by acronyms asMPEG-1 and MPEG-2. MPEG is currently working on a new standard, known asMPEG-4. MPEG-4 video aims at providing standardized core technologiesallowing efficient storage, transmission and manipulation of video datain multimedia environments. A detailed proposal for MPEG-4 is set forthin MPEG-4 Video Verification Model (VM) 5.0, hereby incorporated byreference.

MPEG-4 considers a scene to be a composition of video objects. In mostapplications, each video object represents a semantically meaningfulobject. Each uncompressed video object is represented as a set of Y, U,and V components (luminance and chrominance values) plus informationabout its shape, stored frame after frame in predefined temporalintervals. Each video object is separately coded and transmitted withother objects. As described in MPEG-4, a video object plane (VOP) is anoccurrence of a video object at a given time. For a video object, twodifferent VOPs represent snap shots of the same video object at twodifferent times. For simplicity we have often used the term video objectto refer to its VOP at a specific instant in time.

As an example, FIG. 1(A) illustrates a frame for coding that includes ahead and shoulders of a narrator, a logo suspended within the frame anda background. FIGS. 1(B)-1(D) illustrate the frame of FIG. 1(A) brokeninto three VOPs. By convention, a background generally is assigned VOPØ.The narrator and logo may be assigned VOP1 and VOP2 respectively. Withineach VOP, all image data is coded and decoded identically.

The VOP encoder for MPEG-4 separately codes shape information andtexture (luminance and chrominance) information for the video object.The shape information is encoded as an alpha map that indicates whetheror not each pixel is part of the video object. The texture informationis coded as luminance and chrominance values. Thus, the VOP encoder forMPEG-4 employs explicit shape coding because the shape information iscoded separately from the texture information (luminance and chrominancevalues for each pixel). While an explicit shape coding technique canprovide excellent results at high bit rates, explicit shape codingrequires additional bandwidth for carrying shape information separatefrom texture information. Moreover, results are unimpressive for theexplicit shape coding at low coding bit rates because significantbandwidth is occupied by explicit shape information, resulting in lowquality texture reconstruction for the object.

As an alternative to explicitly coding shape information, implicit shapecoding techniques have been proposed in which shape information is notexplicitly coded. Rather, in implicit shape coding, the shape of eachobject can be ascertained based on the texture information. Implicitshape coding techniques provide a simpler design (less complex thanexplicit technique) and a reasonable performance, particularly at lowerbit rates. Implicit shape coding reduces signal bandwidth because shapeinformation is not explicitly transmitted. As a result, implicit shapecoding can be particularly important for low bit rate applications, suchas mobile and other wireless applications.

However, implicit shape coding generally does not perform as well asexplicit shape coding, particularly for more demanding scenes. Forexample, objects often contain color bleeding artifacts on object edgeswhen using implicit shape coding. Also, it can be difficult to obtainlossless shapes using the implicit techniques because shape codingquality is determined by texture coding quality and is not providedexplicitly. Therefore, a need exists for an improved implicit shapecoding technique.

SUMMARY OF THE INVENTION

The system of the present invention can include an encoding system and adecoding system that overcomes the disadvantages and drawbacks of priorsystems.

An encoding system uses chroma-key shape coding to implicitly encodeshape information with texture information. The encoding system includesa boundary box generator and color replacer, a DCT encoder, a quantizer,a motion estimator/compensator and a variable length coder. A videoobject to be encoded is enclosed by a bounding box and only macroblocksin the bounding box are processed to improve data compression. Eachmacroblock inside the bounding box is identified as either 1) outsidethe object; 2) inside the object; or 3) on the object boundary.Macroblocks outside the object are not coded to further improve datacompression. For boundary macroblocks, pixels located outside the object(background pixels) are replaced with a chroma-key color K to implicitlyencode the shape of the object. The luminance and chrominance values formacroblocks inside the object and on the object boundary are coded,including transforming the luminance and chrominance values to obtainDCT coefficients, and quantizing (scaling) the DCT coefficients. Motioncompensation can also be performed on some macroblocks to generatemotion vectors. In addition, to improve image quality, boundarymacroblocks can be quantized at a finer level than other macroblocks inthe bounding box. A bitstream is output from the encoding system. Thebitstream can include the encoded macroblock pixel data, a codeidentifying the position (e.g., inside, outside or on the boundary) ofeach coded macroblock, the chroma-key value and thresholds, motionvectors and one or more quantizers. Where a finer quantization isapplied to boundary macroblocks, the bitstream also includes a codeindicating the exact quantizer used for boundary macroblocks and a codeindicating the number of quantization levels for macroblocks inside theobject.

A decoding system includes a variable length decoder, an inversequantizer, a motion compensator, an inverse DCT coder, and colorextractor and shape mask detector. A bitstream is received and decodedby the decoding system to obtain both texture information (e.g.,luminance and chrominance data) and shape information for a videoobject. The shape information is implicitly encoded. DCT coefficientsand motion vectors for each macroblock are inverse quantized (rescaled)based on the codes (quantizers) identifying the specified quantizer orthe specified number of quantization levels for each. The reconstructedvideo object is obtained by passing only the pixel values for the object(e.g., by rejecting pixel values within a predetermined range of thechroma-key). The shape of the video object is obtained by generating abinary map or shape mask (e.g., 1s or 0s) identifying each pixel aseither inside the object or outside the object A gray-scale map (shapemask) can be generated instead by using two thresholds to soften theobject boundaries.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1(A) illustrates an example frame for coding.

FIGS. 1(B)-1(D) illustrate the frame of FIG. 1(a) broken into threeVideo Object Planes.

FIG. 2A is a block diagram illustrating an encoding system according toan embodiment of the present invention.

FIG. 2B is a block diagram of a decoding system according to anembodiment of the present invention.

FIG. 3 illustrates an example of a bounding box bounding a video objectaccording to an embodiment of the present invention.

FIG. 4 illustrates an example of a video object according to anembodiment of the present invention.

FIG. 5 is a flow chart illustrating the operation of an encoding systemaccording to an embodiment of the present invention.

FIG. 6 is a flow chart illustrating the operation of a decoding systemaccording to an embodiment of the present invention.

DETAILED DESCRIPTION

Referring to the drawings in detail, wherein like numerals indicate likeelements, FIG. 2A is a block diagram illustrating an encoding systemaccording to an embodiment of the present invention. FIG. 2B is a blockdiagram of a decoding system according to an embodiment of the presentinvention.

Encoding system 202 uses chroma-key shape coding to implicitly encodeshape information. According to the present invention, an encodingsystem 202 (FIG. 2A) receives a video picture or frame including asegmented video object as an input signal over line 204, representativeof a VOP to be coded (e.g., includes the object and some background).The input signal is sampled and organized into macroblocks which arespatial areas of each frame. The encoding system 202 codes themacroblocks and outputs an encoded bitstream over a line 220 to achannel 219. The channel 219 may be a radio channel, a computer networkor some storage media such as a memory or a magnetic or optical disk. Adecoding system 230 (FIG. 2B) receives the bitstream over line 228 fromthe channel 219 and reconstructs a video object therefrom for display.

Encoding system 202 includes a bounding box generator and color replacer206 for generating a bounding box around the segmented video object andfor replacing pixel values located outside the object boundary with apredetermined key color (or chroma-key color) K, according to anembodiment of the present invention. The chroma-key color and somethreshold values are output on line 203 by bounding box generator andcolor replacer 206. According to an embodiment of the present invention,instead of enclosing each video object in a full size picture andprocessing all macroblocks in the received full size picture, the videoobject can advantageously be enclosed by a bounding box and onlymacroblocks in the bounding box are processed (e.g., only pixel data ispassed for macroblocks inside the bounding box). According to anembodiment of the present invention, the position of the bounding box ischosen such that it contains a minimum number of 16 pixel×16 pixelmacroblocks (while bounding the video object). As a result, processingtime is reduced. In this manner, bounding box generator and colorreplacer 206 implicitly encodes information describing the shape of thevideo object in the texture (luminance and chrominance values)information for the object. According to an embodiment of the presentinvention, the bounding box generator and color replacer 206 outputssignals on line 201 including texture information (pixel values) for theobject (for pixels inside the object boundary), and outputs thechroma-key pixel value for pixels outside the object boundary (becausethese pixels outside the object boundary were replaced with thechroma-key color).

The output of generator and color replacer 206 is coupled via line 201to a macroblock formatter and mode decider 207. Macroblock formatter andmode decider 207 divides the video object into macroblocks (MBs),determines whether each MB is inside the boundary (of the video object),outside the boundary, or on the boundary (e.g., having pixels inside andpixels outside the boundary of the object), known as the mode. Themacroblock formatter and mode decider 207 then outputs afirst_shape_code for each macroblock identifying the mode of eachmacroblock.

In addition, according to an embodiment of the present invention,macroblock formatter and mode decider 207 also operates like a filterbecause it outputs pixel data on line 208 (to be encoded) only formacroblocks that are either inside the boundary or on the boundary(pixel data are not output for macroblocks outside the boundary). Thefirst_shape_code is generated for each macroblock and identifies thosemacroblocks for which no pixel data is transmitted. Thus, datacompression and encoding speed are improved because pixel data formacroblocks outside the boundary will not be encoded and transmitted.

The pixel data on line 208 (including texture information or pixelvalues for the pixels inside the object boundary, and the replacedchroma-key values for those pixels outside the object boundary andinside the bounding box) is input to a difference circuit 215 and to amotion estimator/compensator 209. Motion estimator/compensator 209generates a motion predicted signal that is output on line 225.Difference circuit 215 subtracts the motion predicted signal (on line225) and the pixel data (on line 208) to output pixel difference valueson line 213.

The pixel (image) difference values are input to a DCT encoder 210 vialine 213. DCT encoder 210 performs a transformation of the image data,such as discrete cosine transform (“DCT”) coding or sub-band coding,from the pixel values (luminance and chrominance values) to DCTcoefficients (frequency domain). A block of pixels is transformed to anequivalently sized block of DCT coefficients. DCT encoder 210 outputsDCT coefficients (corresponding to the pixel data) on line 212.

A quantizer 214 is connected via line 212 to DCT encoder 210. Quantizer214 scales or quantizes the DCT coefficients output on line 212 bydividing each coefficient by a predetermined quantizer. The quantizer isa constant or variable scalar value (Q_(p)). For example, the DCTcoefficients can be quantized by dividing each coefficient by thequantizer (Q_(p)). In general, the quantizer 214 reduces bandwidth ofthe image signal by reducing a number of quantization levels availablefor encoding the signal. The quantization process is lossy. Many smallDCT coefficients input to the quantizer 214 are divided down andtruncated to zero. The scaled signal (scaled or quantized DCTcoefficients) is output from quantizer 214 via line 216.

Usually, the same quantizer (a VOP_quant) is used to quantize DCTcoefficients for all macroblocks of a VOP. However, according to anembodiment of the present invention, certain macroblocks (e.g. boundarymacroblocks) can be quantized using a smaller quantizer to better definethe boundary or edge of an object. A special quantizer for boundarymacroblocks (indicated by bound_quant) is used for boundary macroblocks.The boundary quantizer is specified by the bound_quant signal, which isoutput on line 217 from quantizer 214.

An inverse quantizer and inverse DCT encoder (e.g., a DCT decoder)receives the scaled DCT coefficients via line 216, inverse quantizes theDCT coefficients and then converts the DCT coefficients to pixel valuesto generate the pixel difference values, output on line 223.

An adder circuit 224 receives as inputs, the pixel difference signal vialine 223 and the motion predicted signal 225 (from motionestimator/compensator 209). Adder circuit 224 generates an approximatevalue of the input signal (provided on line 208). This approximationsignal, output on line 226, is the current frame data and is input tomotion estimator/compensator 209 to be used as a predictor for the nextframe.

Motion estimator/compensator 209 performs motion estimation/compensationto output the motion predicted signal on line 225 and motion vectors(MV) based on the pixel data input on line 208 and the approximation ofthe pixel data input on line 226. Motion vectors (MV) for one or moremacroblocks are output via line 211.

A variable length coder 218 variable length codes the scaled DCTcoefficients (input on line 216), motion vectors (MVs input on line211), the chroma-key color and thresholds (input on line 203) and thebound_quant value (input on line 217) into a bitstream. The bitstream isoutput via line 220 to channel 219 for transmission.

Decoding system 230 (FIG. 2B) receives the encoded bitstream fromchannel 219 via line 228. A variable length decoder 232 variable lengthdecodes the encoded bitstream into scaled DCT coefficients (output online 234) for each macroblock, motion vectors for each macroblock (MVsoutput on line 222), the first_shape_codes for each macroblock (outputon line 243), the bound_quant value (output on line 241) and thechroma-key color and threshold values (output on line 245).

The scaled DCT coefficients are input via line 234 and the bound_quantvalue is input via line 241 to inverse quantizer 236. Inverse quantizer236 rescales the DCT coefficients according to the quantizer which is aconstant or variable scalar value (Q_(p) or VOP_quant). For example, thecoefficients can be rescaled by multiplying each coefficient by thequantizer (Q_(p)) (both the standard quantizer Q_(p) and the bound_quantvalue can be transmitted with the bitstream). Inverse quantizer 236increases a number of quantization levels available for encoding thesignal (e.g., back to the original number of quantization levels).Inverse quantizer 236 may use one quantizer for macroblocks inside theboundary (e.g., VOP_quant), and a finer quantizer (bound_quant) forboundary macroblocks. The same quantizers used at the encoding system202 are also used at the decoding system 230.

Inverse DCT encoder 240 performs an inverse DCT transform on the DCTcoefficients received as an input via line 237 to output pixel values(luminance and chrominance values) for each macroblock on line 246.

For those macroblocks that were coded using motion compensation, themotion predicted signal provided on line 244 (output from motioncompensator 242) is added by adder circuit 248 to the pixel values online 246 to output the reconstructed pixel values for each macroblock online 251. Motion compensator 242 generates the motion predicted pixelsignal on line 244 based on the reconstructed pixel signal on line 251and the motion vectors for each macroblock received via line 222.

The reconstructed pixel signal is input via line 251 to a colorextractor and shape mask generator 249. The color extractor and shapemask generator 249 also receives as inputs the chroma-key color andthresholds (via line 245) and the first_shape_code (via line 243). Thecolor extractor and shape mask generator 249 compares each pixel value(in the reconstructed pixel signal) to the chroma-key value (or a rangeof values near the chroma-key color). By comparing the pixel values tothe chroma-key value, the color extractor and shape mask generator 249can determine which pixels are located within the object and whichpixels are located outside of the object and thereby identify theoriginal shape of the object in the VOP. The pixels located within theobject are output via line 252 as a reconstructed video object(stripping off the chroma-key or background pixels to output objectpixel values). Also, color extractor and shape mask generator 249generates and outputs a shape mask identifying the shape of the videoobject. The shape mask can be generated as a binary map (e.g., a 1 or 0for each pixel) or a gray scale map identifying whether each pixel iseither inside or outside the video object. The shape mask is output vialine 254 and can be used, for example, by a compositer to combinemultiple video objects into a single (multi-object) frame.

The above-described chroma-key shape coding technique of the presentinvention provides a simple and efficient method for video shape coding.Furthermore, the present invention includes several additional featuresand advantages that further improve or refine the above-describedchroma-key shape coding technique without adding unjustifiable overheador complexity. The present invention can include one or more of thefollowing features:

1. Bounding Box: Process Only Macroblocks Inside the Bounding Box:

Instead of enclosing each video object in a full size picture andprocessing all macroblocks in the picture, the video object canadvantageously be enclosed by a bounding box and only macroblocks in thebounding box are processed. Prior to calculating a bounding box aroundthe object, the object is first segmented from the video frame. Any ofseveral well-known segmentation techniques can be used to segment thevideo object from the remainder of the video frame. The position of thebounding box is chosen such that it contains a minimum number of 16pixel×16 pixel macroblocks. The encoding/decoding process is performedon a macroblock basis. In this manner, processing time can be reduced,

FIG. 3 illustrates an example of a bounding box 310 that bounds a videoobject 315. The bounding box 310 is divided into a plurality ofmacroblocks 320. (This is similar to the bounding box used in theexplicit shape coding of MPEG-4 Verification Model (VM).) As a result,macroblocks within the bounding box 310 are either 1) inside the object315 (where the macroblock is completely inside the object); 2) outsidethe object 315 (where the macroblock is completely outside the object);or 3) on the object boundary (e.g., the macroblock has both pixel(s)inside the object and pixel(s) outside the object).

FIG. 4 illustrates an example of a video object according to anembodiment of the present invention. Video object 405 is bounded by abounding box (not shown). The bounding box is divided into a pluralityof macroblocks. Some of the macroblocks are illustrated in FIG. 4. Forexample, macroblocks MB1, MB2 and MB5 are outside the video object 405.Macroblocks MB11, MB12 and MB14-16 are located inside the video object405. Also, macroblocks MB3, MB4, MB6, MB7, MB9 and MB13 are on theobject boundary.

2. First_shape_code:

For Each macroblock in the bounding box, the present invention can use afirst_shape_code to identify whether the macroblock is:

a) outside the object;

b) inside the object; or

c) on the object boundary. A first_shape_code is transmitted with thedata for each macroblock. (For those macroblocks outside the boundary,only the first_shape_code will be transmitted).

The first_shape_code can be implemented several different ways. Twoexamples of a first_shape_code are described below:

TABLE 1 first_shape_code Macroblock Shape 0 all_0 (outside the object) 1others (inside or on boundary)

In Table 1, first_shape_code is a 1 bit code that indicates whether themacroblock is outside the video object or not. A first_shape_code of 0indicates that the macroblock is outside the object. A first_shape_codeof 1 indicates that the macroblock is either inside the object or on theboundary.

TABLE 2 first_shape_code Macroblock Shape 0 boundary 10 all_0 (outsidethe object) 11 all_255 (inside the object)

In Table 2, the first_shape_code is transmitted as a two bit code. Thetwo bits can be used to identify whether the macroblock is located onthe boundary, outside the object, or inside the object.

3. Within the Bounding Box, Apply Chroma-keying Only to BoundaryMacroblocks: Background Macroblocks are Not Coded:

For macroblocks on the boundary (identified, for example, by thefirst_shape_code), pixels outside the object (e.g., background pixels)are replaced with the chroma-key color. This chroma-key replacement ofbackground pixels is performed only for boundary macroblocks. Replacingthe background pixels in the boundary macroblocks with the chroma-keyimplicitly codes shape information for the object. Also, macroblocksoutside the object (and within the bounding box) are not coded.

After chroma-key pixel replacement, only blocks inside the object or onthe boundary are coded (e.g., DCT transformed, quantized, and variablelength coded for transmission). By not coding macroblocks locatedoutside the video object (background macroblocks), a significant numberof overhead bits can be saved, thereby increasing data compression.

In addition, information should be sent identifying those macroblocksinside the bounding box and outside the object (and thus, identifyingthose macroblocks that were not coded). An additional bit can be addedto the first_shape_code to identify those macroblocks that are withinthe bounding box but outside the object (identifying those macroblocksthat are not coded).

4. Bound_quant: Use a Finer Quantization for Boundary Macroblocks:

To further improve image quality, a finer quantization can be used forthe boundary macroblocks, as compared to the quantization for the othermacroblocks in the bounding box. This can be done by quantizer 214 (FIG.2A) scaling or quantizing the DCT coefficients output on line 212according to a smaller quantizer for the boundary macroblocks.Therefore, quantizer 214 uses a larger number of quantization levels(e.g., a smaller quantizer) for the boundary macroblocks resulting infiner quantization of the boundary macroblocks. Because bandwidth islimited, using a larger number of quantization levels (e.g., a quantizerless than 1) for the boundary macroblocks allocates or apportions alarger number of the available bits (bandwidth) to boundary macroblocksto better define the outer edge or boundary of the video object.

According to an embodiment of the present invention, a finerquantization for boundary blocks can be specified through a boundaryquantization code (bound_quant). In MPEG-4 VM, a VOP quantization code(VOP_quant) is a five-bit code that specifies the quantization for theVOP. In MPEG-4, DCT coefficients are divided by the VOP quantizationcode. According to the present invention, the background macroblockswithin the bounding box are not coded. Therefore, according to anembodiment of the present invention, VOP_quant specifies the number ofquantization levels for macroblocks inside the object and bound_quantspecifies the number of quantization levels for boundary macroblocks.

According to an embodiment of the present invention, the bound_quantcode can be used to specify the level of quantization for boundarymacroblocks relative to the level of quantization for the othermacroblocks, as follows:

TABLE 3 bound_quant times VOP_quant 00 ½ 01 ⅝ 10 ⅞ 11 1

In Table 3, a bound_quant code indicates the quantization parameter forboundary macroblocks as compared to the quantization parameter of othermacroblocks. For example, a bound_quant of 11 indicates that thequantization parameter for boundary macroblocks is the same as (onetimes) the quantization parameter for other macroblocks in the boundingbox (the VOP_quant). This indicates that there are the same quantizationparameter for the boundary macroblocks as for other macroblocks.

A bound_quant code of 00 similarly indicates that the quantizationparameter is one half for the boundary macroblocks as for othermacroblocks resulting in finer quantization of the boundary macroblocks.Other values for the bound_quant code specify various other number ofquantization parameters for boundary macroblocks. Other techniques canbe used to specify an increased number of quantization levels (finerquantization) for boundary macroblocks (as compared to othermacroblocks).

5. Choice of Chroma-key Color:

Although the choice of key color is an encoding issue, it has thepotential of causing shape degradation due to potential color leakage ifsaturated colors are used. (Saturation is the degree of purity of acolor; for example, a pure spectral color having a single wavelength hasa saturation of 100%, while white light has a saturation of zero). Onthe other hand, use of a saturated color improves shape recovery becausenatural scenes do not often contain such colors. However, the onlyrestriction for chroma-keying is that the chroma-key color does notexist in the scene. The use of less saturated colors has beeninvestigated, similar to the ones used in studio environments forchroma-keying of scenes.

A relatively saturated color can be used, such as Y=50, Cb=200, Cr=100.However, weaker colors (less saturated) can be used to reduce thepotential for shape distortion due to color bleeding. According to anembodiment of the present invention, an example of a less saturatedcolor that can be used to decrease the potential for color bleeding isY=135, Cb=160, Cr=110. Other less saturated colors can be similarly usedas the chroma-key color to decrease the potential for shape distortion.For notational simplicity, instead of using Cb and Cr, the notations ofU and V, respectively, will be used in the remainder of this application(although strictly speaking Cb and Cr differ from U and V by a smallscaling factor and an offset).

FIG. 5 is a flow chart illustrating the operation of an encoding systemaccording to an embodiment of the present invention.

At step 510 a video frame is received and a video object is segmentedfrom the remainder of the video frame. One of several well knowntechniques can be used to segment the object.

At step 515, a bounding box is created around the video object (VOP).The position of the bounding box is chosen such that it contains aminimum number of 16 pixel×16 pixel macroblocks. Other size macroblockscan be used. Processing is performed on a macroblock basis.

At step 520, each background pixel (pixels outside the object) isreplaced with the chroma-key color K. This can be performed for allpixels in the picture or frame or performed only for boundarymacroblocks.

At step 525, within the bounding box, each macroblock formatted and isidentified as either: 1) outside the video object (a backgroundmacroblock); 2) inside the object; or 3) on the object boundary. A codefor each macroblock, such as the first_shape_code, is used to identifythe position of each macroblock (inside, outside or on the objectboundary).

At step 530, motion compensation is performed on at least some of theboundary or inside macroblocks, including calculating motion vectors.Motion vectors are calculated only for those macroblocks coded withmotion compensation.

At step 535, the luminance and chrominance (pixel) values for boundarymacroblocks and macroblocks located inside the object are coded.According to the present invention, macroblocks outside the object(e.g., background macroblocks) are not coded. Thus, in the event thatall pixels (including pixels outside the bounding box) were replacedwith the chroma-key at step 520, these replaced pixels located outsidethe bounding box are simply discarded (but the first_shape_codesindicate which macroblocks have no data transmitted for them). Codingincludes DCT transforming the luminance and chrominance values for themacroblocks to obtain DCT coefficients, and then quantizing (scaling)the DCT coefficients. The motion vectors and the scaled DCT coefficientsare then variable length coded. The steps of DCT transforming,quantizing (generally), performing motion compensation, calculatingmotion vectors and variable length coding can be performed, for example,in a manner similar to that set forth in MPEG-4 VM 5.0. According to anembodiment of the present invention, boundary macroblocks can bequantized using finer quantization than macroblocks inside the object.

At step 540, a coded bit stream is output from the encoding system tothe channel. The bit stream includes the transformed and quantized(scaled) luminance and chrominance data for each coded macroblock,motion vectors, codes (such as the first_shape_code) identifying theposition or mode (e.g., inside, outside or on the boundary) of eachmacroblock, a code (such as the VOP_quant code) indicating the level ofquantization for macroblocks located inside the object and a code (suchas the bound_quant code) indicating the relative level of quantizationfor boundary macroblocks (if different), motion vectors, and thechroma-key and threshold values. The bit stream can also includeadditional information. For boundary macroblocks, pixels located outsidethe object have been replaced with the chroma-key color so as toimplicitly code the shape of the object within the texture information(luminance and chrominance data) for the object.

To reduce overhead and improve data compression, macroblocks locatedoutside the object (e.g., background macroblocks) are not coded, and thechroma key is applied to background pixels only for boundarymacroblocks. In addition, a finer quantization can be used for boundarymacroblocks to improve image quality.

FIG. 6 is a flow chart illustrating the operation of a decoding systemaccording to an embodiment of the present invention.

At step 610, the bit stream is received from the channel, and thevariable length codes are decoded to obtain the scaled DCT coefficients,motion vectors (MVs), codes identifying the location or mode ofmacroblocks (e.g., first_shape_code), quantizers (e.g., VOP_quant,bound_quant), and chroma-key color and thresholds. Image data is notprovided for the identified background macroblocks.

At step 615, the data (including DCT coefficients and motion vectors)for each macroblock is inverse quantized (rescaled) based on thebound_quant code (for boundary macroblocks) and the VOP_quant code (formacroblocks inside the object).

At step 620, the DCT coefficients are inverse DCT transformed, andmotion compensation is performed based on the motion vectors (for thosemacroblocks coded with motion compensation) to generate motioncompensated luminance and chrominance pixel values for macroblocksinside the object and on the object boundary. This can be performed, forexample, as specified by MPEG-4 VM.

At step 622, the chroma-key and thresholds (described in greater detailin the example below) are decoded.

At step 625, the reconstructed video object is recovered, and the shapeof the object is recovered. The reconstructed video object can berecovered by passing only pixel values that are not equal to thechroma-key color (or not within a small range of the chroma-key color.This passes only the object pixel data.

Object shape information can be recovered by generating a shape mask ora segmentation map, indicating which pixels are part of the object, andwhich pixels are not. According to an embodiment of the presentinvention the segmentation map can be generated as a binary segmentationmap. The binary segmentation map can be generated by determining whetheror not each pixel value is near the chroma-key value K. If a pixel isnear the chroma-key value (e.g., within a threshold T of the chroma-keyvalue), then the pixel is not included in the recovered video object orframe. If the pixel is not near the chroma key value (e.g., the pixelvalue is not within a threshold of the chroma-key value), then the pixelis included in the recovered video object (considered foreground). Thevideo object has the shape indicated by the binary segmentation map anda texture (luminance and chrominance values) indicated by those decodedpixel values which are not near the chroma-key value. If thefirst_shape_code indicates which macroblocks are on the object boundary,then color extraction (e.g., comparison of the pixel to the chroma-keyto determine if the pixel is inside or outside the boundary) need onlybe performed for boundary macroblocks to obtain a binary map identifyingthe shape of the object.

One problem with the use of a single threshold T to generate a binarysegmentation map at the decoder for chroma-keying is that the sharpboundary condition can cause a rough or jagged edge for the objectboundary. Instead of a binary map as described above, the segmentationmap can have gray-level values to create softer boundaries. In computergraphics or in blue-screen movies, alias-free natural looking boundariescan be generated using two thresholds instead of one at the boundaryregions.

According to another embodiment of the present invention, instead ofusing a single threshold T at the decoding system, two thresholds T₁ andT₂ can be used. The region between T₁ and T₂ is the boundary. A value of0 indicates background and a value of 255 indicates foreground (theobject), assuming 8 bits of coding per pixel (merely as an example).Note that T₁ affects the amount of background while T2 affects theamount of foreground. If T₂ is too high, part of the foreground will betoo high. If T₁ is too low, part of the background will be included inthe object, and hence introduce artifacts. On the other hand, if T₁ andT₂ are too close to each other, then the object boundary becomes harder(losing the advantages of boundary softening). The tradeoffs among thesefactors can be used to select the best thresholds for a particularapplication. For example, human interaction and subjectivedeterminations can be used at the encoding system to select thethresholds T₁ and T₂. T₁ can be set equal to T₂ to create the stepfunction or sharp boundary condition provided by the binary segmentationmap.

Using two thresholds T₁ and T₂, the shape information can be recoveredfrom the reconstructed texture information as follows:

1) Calculate an alpha value for a decoded pixel (X) by either of twomethods:

Method 1: d=(K_(Y)−X_(Y))²+(K_(U)−X_(U))²+(K_(V)−X_(V))²; default method

Method 2: d₁=|K_(Y)−X_(Y)|+|K_(U)−X_(U)|+|K_(V)−X_(V); alternate method.

If method 2 is employed ‘d₁’ needs to be multiplied by a scaling factor(≦d) to fit the same range as ‘d’ computed by method 1, with respect towhich thresholds T₁ and T₂ are sent.

2) The alpha value (α) for each pixel is a function of distance dbetween the reconstructed YUV values of pixel X and the key color K:

if (d<T₁) then α=0;

else if (T₁<d<T₂) then α=(d−T₁)/(T₂−T₁)×255;

else if (d>T₂) then α=255.

The values T₁ and T₂ are set-by the encoder (assuming method 1 forcomputing d) and sent to the decoder as side information. According toan embodiment of the present invention, α can denote the transparency ofa pixel, where α being 255 indicates that the object is opaque, and αbeing 0 indicates that he pixel is transparent. The resulting value fora pixel that has an α somewhere between 0 and 255 is semi-transparentand is a weighted combination of the pixel value in the current pictureand the pixel value from a background picture that is specifiedexternally or in advance. This allows a smoothing or blending functionto be performed at object boundaries. Thus, the resulting pixel valuefor each component (Y, U and V) can be calculated as:

[α·X+(255−α)·Z]/255

where X is the decoded pixel component value (X_(Y), X_(U) or X_(V)),and Z is the pixel component value (Z_(Y), Z_(U) or Z_(V)) for eachcomponent of the background picture. This calculation should beperformed for each component value (Y, U, V).

The system of the present invention can include an encoding system 202and a decoding system 230. Encoding system 202 uses chroma-key shapecoding to implicitly encode shape information. Encoding system 202includes a bounding box generator and color replacer 206, a macroblockformatter and mode decider 207, a DCT encoder 210, a quantizer 214, amotion estimator/compensator 209 and a variable length coder 218. Avideo object to be encoded is enclosed by a bounding box and onlymacroblocks in the bounding box are processed. The position of thebounding box is chosen such that it contains a minimum number ofmacroblocks. The encoding/decoding process is performed macroblock bymacroblock. To increase data compression, macroblocks outside thebounding box are not coded.

A code can be used to identify each macroblock inside the bounding boxas either 1) outside the object; 2) inside the object; or 3) on theobject boundary. For boundary macroblocks, pixels located outside theobject (e.g., background pixels) are replaced with a chroma-key color Kto implicitly encode the shape of the object. The luminance andchrominance values for macroblocks inside the object and on the boundaryare coded. Coding includes, for example, transforming the luminance andchrominance values to obtain DCT coefficients, and quantizing (scaling)the DCT coefficients. Motion compensation can also be performed onmacroblocks to generate motion vectors. In addition, boundarymacroblocks can be quantized at a finer level to improve image quality.A bitstream is output from encoding system 202. The bitstream includesthe transformed and quantized (scaled) luminance and chrominance datafor each coded macroblock, motion vectors, codes (such as thefirst_shape_code) identifying the position (e.g., inside, outside or onthe boundary), a quantizer code (such as the VOP_quant code) indicatingthe number of quantization levels for macroblocks located inside theobject and a quantizer code (such as the bound_quant code) indicatingthe number of quantization levels for boundary macroblocks (ifdifferent).

Decoding system 230 includes a variable length decoder 232, an inversequantizer 236, a motion compensator 242, an inverse DCT 240, and a colorextractor and shape mask generator 249. A bitstream is received anddecoded by decoding system 230 is used to obtain both textureinformation (e.g., luminance and chrominance data) and shape informationfor a video object. The shape information is implicitly encoded. DCTcoefficients and motion vectors for each macroblock are requantized(rescaled) based on the bound_quant code (for boundary macroblocks) andthe VOP_quant code (for macroblocks inside the object). Motioncompensated luminance and chrominance values are generated based on themotion vectors. A color extractor and shape mask generator 249reconstructs the video object by passing only pixel values that aredifferent from the chroma-key color, and generates a shape mask(identifying the shape of the object), also by comparing pixel values tothe chroma-key color. These two processes can be performed together. Theshape of the object (and thus, an identification of the object itself)can be determined by comparing each pixel value with the chroma-keyvalue K. If a pixel is within a predetermined threshold of thechroma-key value, the pixel is not included in the recovered videoobject or frame (rather, it is considered background). If the pixel isnot within a threshold of the chroma-key value, then the pixel isincluded in the recovered video object (considered foreground). Theshape of the video object is thus recovered (e.g., by generating abinary shape mask at the decoding system based on the pixel valuecomparison). For example, the binary shape mask can be generated as 1 sfor object data and 0 s for the other (background) pixels. The textureof the object is recovered as the decoded luminance and chrominancevalues of the object (e.g., pixel values outside the threshold of thechroma-key value are output as texture data of the object). Also, agray-scale segmentation map can be generated using two thresholds tosoften the object boundaries.

What is claimed is:
 1. A method of implictly encoding shape informationfor a video object, the method comprising: receiving a video frame thatincludes a video object; creating a box bounding the video object, thebounding box divided into a plurality of macroblocks, each macroblockcomprising a plurality of chrominance and luminance pixels; replacing afirst set of pixels that are in a first macroblock with a key color,wherein the first macroblock is on the object boundary and the first setof pixels are outside the object boundary; coding a first set ofmacroblocks to obtain a first coded set of macroblocks and coding asecond set of macroblocks to obtain a coded second set of macroblocks,wherein the first set of macroblocks is on the object boundary andincludes the first macroblock, and wherein the second set of macroblocksis inside the object; and outputting a bitstream including the firstcoded set of macroblocks and second coded set of macroblocks.
 2. Themethod of claim 1, wherein coding the first set of macroblocks includestransforming luminance and chrominance values for the first set ofmacroblocks to obtain a first set of discrete cosine transformcoefficients, and wherein coding the second set of macroblocks includestransforming luminance and chrominance values for the second set ofmacroblocks to obtain a second set of discrete cosine transformcoefficients.
 3. The method of claim 2, wherein coding the first set ofmacroblocks further includes quantizing the first set of discrete cosinetransform coefficients, and wherein coding the second set ofmacroblocks, further includes quantizing the second set of discretecosine transform coefficients.
 4. The method of claim 3, wherein thesecond set of macroblocks is quantized using a finer quantization. 5.The method of claim 1, wherein coding the first set of macroblocksfurther includes performing motion compensation for the first set ofmacroblocks, and wherein coding the second set of macroblocks furtherincludes performing motion compensation for the second set ofmacroblocks.
 6. A system for implictly encoding shape information for avideo object, the system comprising: a means for receiving a video framethat includes a video object; a means for creating a box bounding thevideo object, the bounding box divided into a plurality of macroblocks,each macroblock comprising a plurality of chrominance and luminancepixels; a means for replacing a first set of pixels that are in a firstmacroblock with a key color, wherein the first macroblock is on theobject boundary and the first set of pixels are outside the objectboundary; a means for coding a first set of macroblocks to obtain afirst coded set of macroblocks and coding a second set of macroblocks toobtain a coded second set of macroblocks, wherein the first set ofmacroblocks is on the object boundary and includes the first macroblock,and wherein the second set of macroblocks is inside the object; and ameans for outputting a bitstream including the first coded set ofmacroblocks and second coded set of macroblocks.
 7. The system of claim6, wherein coding the first set of macroblocks includes transformingluminance and chrominance values for the first set of macroblocks toobtain a first set of discrete cosine transform coefficients, andwherein coding the second set of macroblocks includes transformingluminance and chrominance values for the second set of macroblocks toobtain a second set of discrete cosine transform coefficients.
 8. Thesystem of claim 7, wherein coding the first set of macroblocks furtherincludes quantizing the first set of discrete cosine transformcoefficients, and wherein coding the second set of macroblocks furtherincludes quantizing the second set of discrete cosine transformcoefficients.
 9. The system of claim 8, wherein the second set ofmacroblocks is quantized using a finer quantization.
 10. The system ofclaim 6, wherein coding the first set of macroblocks further includesperforming motion compensation for the first set of macroblocks, andwherein coding the second set of macroblocks further includes performingmotion compensation for the second set of macroblocks.
 11. Amachine-readable medium having stored thereon a plurality of executableinstructions, the plurality of instructions comprising instructions to:receive a video frame that includes a video object; create a boxbounding the video object, the bounding box divided into a plurality ofmacroblocks, each macroblock comprising a plurality of chrominance andluminance pixels; replace a first set of pixels that are in a firstmacroblock with a key color, wherein the first macroblock is on theobject boundary and the first set of pixels are outside the objectboundary; code a first set of macroblocks to obtain a first coded set ofmacroblocks and coding a second set of macroblocks to obtain a codedsecond set of macroblocks, wherein the first set of macroblocks is onthe object boundary and includes the first macroblock, and wherein thesecond set of macroblocks is inside the object; and output a bitstreamincluding the first coded set of macroblocks and second coded set ofmacroblocks.
 12. The machine-readable medium of claim 11, wherein theinstruction to code the first set of macroblocks includes instructionsto transform luminance and chrominance values for the first set ofmacroblocks to obtain a first set of discrete cosine transformcoefficients, and wherein the instructions to code the second set ofmacroblocks includes instructions to transform luminance and chrominancevalues for the second set of macroblocks to obtain a second set ofdiscrete cosine transform coefficients.
 13. The machine-readable mediumof claim 12, wherein the instructions to code the first set ofmacroblocks further includes instructions to quantize the first set ofdiscrete cosine transform coefficients, and wherein the instructions tocode the second set of macroblocks further includes instructions toquantize the second set of discrete cosine transform coefficients. 14.The machine-readable medium of claim 13, wherein the second set ofmacroblocks is quantized using a finer quantization.
 15. Themachine-readable medium of claim 11, wherein coding the first set ofmacroblocks further includes performing motion compensation for thefirst set of macroblocks, and wherein coding the second set ofmacroblocks further includes performing motion compensation for thesecond set of macroblocks.
 16. A method of decoding a video bitstream,the method comprising: receiving a bitstream representing a videoobject, the bitstream including encoding information for a plurality ofmacroblocks inside the video object and for a plurality of macroblockson a video object boundary; decoding the bitstream to obtain textureinformation for the plurality of macroblocks inside the video object andfor the plurality of macroblocks on a video object boundary; decodingthe bitstream to obtain texture information for the plurality ofmacroblocks inside the video object and for the plurality of macroblockson the video object boundary; and recovering an approximate shape of thevideo object by analyzing the texture information of at least theboundary macroblocks and rejecting pixel values within a predeterminedrange of a chromo-key.
 17. A system for a video bitstream, the systemcomprising: a means for receiving a bitstream representing a videoobject, the bitstream including encoded information for a plurality ofmacroblocks inside the video object and for a plurality of macroblockson a video object boundary; a means for decoding the bitstream to obtaintexture information for the plurality of macroblocks inside the videoobject and for the plurality of macroblocks on the video objectboundary; and a means for recovering an approximate shape of the videoobject by analyzing the texture information of at least the boundarymacroblocks and rejecting pixel values within a predetermined range of achroma-key.
 18. A machine-readable medium having stored thereon aplurality of executable instructions, the plurality of instructionscomprising instructions to: receive a bitstream representing a videoobject, the bitstream including encoded information for a plurality ofmacroblocks inside the video object and for a plurality of macroblockson a video object boundary; decode the bitstream to obtain textureinformation for the plurality of macroblocks inside the video object andfor the plurality of macroblocks on the video object boundary; andrecover an approximate shape of the video object by analyzing thetexture information of at least the boundary macroblocks and rejectingpixel values within a predetermined range of a chroma-key.